package com.cspg.ssss.vo;

public class ResultVoUtil {
    /**
     * 操作成功
     * @param msg 提示信息
     * @param object 对象
     */
    public static ResultVo success(String msg, Object object){
        ResultVo resultVo = new ResultVo();
        resultVo.setRetCode("0000");
        resultVo.setRetMsg(msg);
        resultVo.setRetData(object);
        return resultVo;
    }
    public static ResultVo success(String msg, Object object,String retcode){
        ResultVo resultVo = new ResultVo();
        resultVo.setRetCode(retcode);
        resultVo.setRetMsg(msg);
        resultVo.setRetData(object);
        return resultVo;
    }
    /**
     * 操作有误
     * @param errorCode 错误码
     * @param msg 提示信息
     */
    public static ResultVo error(String errorCode, String msg){
        ResultVo resultVo = new ResultVo();
        resultVo.setRetMsg(msg);
        resultVo.setRetCode(errorCode);
        resultVo.setRetData(null);
        return resultVo;
    }

    /**
     *
     * @param errorCode
     * @param msg
     * @param obj
     * @return
     */
    public static ResultVo error(String errorCode, String msg,Object obj){
        ResultVo resultVo = new ResultVo();
        resultVo.setRetMsg(msg);
        resultVo.setRetCode(errorCode);
        resultVo.setRetData(obj);
        return resultVo;
    }

    /**
     * 操作有误，使用默认9999错误码
     * @param msg 提示信息
     */
    public static ResultVo error(String msg){
        ResultVo resultVo = new ResultVo();
        resultVo.setRetMsg(msg);
        resultVo.setRetCode("9999");
        resultVo.setRetData(null);
        return resultVo;
    }
}
